FILE: DDP_INTER:TOS HEWLETT-PACKARD: DDP_INTERFACE (c) Coleco 1983 Confidential Mon, 21 May 1984, 16:35 Page 1 1 ;^Z80^ 3 ;NAME ^Rev 01 - DTT^ 4 5 De_DDP_INTERFACE MACRO ;Header Rev. 5 6 .GOTO Ede_DDP_INTERFACE 7 8 Project: TAPE, C101 9 10 ****************************** 11 * * 12 * DDP_INTERFACE DTT * 13 * * 14 ****************************** 15 16 Rev History 17 Rev. Date Name Change 18 1 9/13/83 DTT CHANGED TO ALLOW ERROR RETIRES 19 0 7/5/83 DTT Initial Pseudo Code 20 21 Function: 22 REQUEST READS AND WRITES AS DEFINED IN OCB. 23 REQUESTS ABORT_TAPE. 24 TEST STATUS OF TAPE REQUEST. 25 26 27 Ede_DDP_INTERFACE MEND 28 Pseudo_code_DDP_INTERFACE MACRO ;Pseudocode macro area 29 BEGIN: 30 STORE D_OVERLAY_NUMBER 31 HL := POINTER TO OCB := D_OVERLAY_NUMBER*5 + OVERLAY_TABLE_POINTER 32 MOVE OCB TO D_CSA 33 IF WRITE THEN 34 SEND WRITE_COMMAND 35 ELSE 36 SEND READ_COMMAND 37 ENDIF 38 END 39 .GOTO Ep_DDP_INTERFACE 40 41 42 43 Ep_DDP_INTERFACE MEND 44 45 ;Subroutines called 46 ; EXT 47 48 ;Subroutines defined 49 GLOBAL TEST_TAPE 50 GLOBAL ABORT_TAPE 51 GLOBAL LOAD_OVERLAY 52 GLOBAL WRITE_OVERLAY 53 GLOBAL CALC_OCB_ADDR FILE: DDP_INTER:TOS HEWLETT-PACKARD: DDP_INTERFACE (c) Coleco 1983 Confidential Mon, 21 May 1984, 16:35 Page 2 54 GLOBAL WRITE_BLOCKS 55 GLOBAL LOAD_BLOCKS 56 GLOBAL BLOCK_IO 57 ; GLOBAL 58 59 ;Operating system calls 60 ; EXT 61 62 ;Inputs/Outputs passed in registers 63 ; A = OVERLAY NUMBER 1 thru N 64 ; A <> 0 = ERROR 65 66 ;External data areas used 67 EXT OCB_PTR ;POINTER TO OVERLAY CONTROL TABLE 68 69 ;Global data areas defined 70 GLOBAL D_OVERLAY_NUMBER 71 GLOBAL D_TAPE_STATE 72 GLOBAL D_CSA 73 ; GLOBAL 74 75 ;Local equates 76 ; EQU 77 78 ;Global equates 79 GLOBAL READ_TAPE 80 GLOBAL WRITE_TAPE 81 GLOBAL KILL_TAPE 82 0081 READ_TAPE EQU 81H 83 0082 WRITE_TAPE EQU 82H 84 0087 KILL_TAPE EQU 87H 85 ; INCLUDE File_name:userid 86 87 88 PROG 89 90 ; TEST FOR COMPLETION OF IO REQUEST 91 0000' TEST_TAPE: 92 0000' 3A 0000 LD A,(D_CSA) 93 0003' B7 OR A 94 0004' C3 3D00' JP EXIT_TAPE 95 ;* 96 ;* 97 ;* 98 0007' ABORT_TAPE: 99 0007' 3E 87 LD A,KILL_TAPE 100 0009' 32 0000 LD (D_CSA),A 101 000C' C3 3D00' JP EXIT_TAPE 102 ;* 103 ;* 104 105 000F' CALC_OCB_ADDR: 106 000F' 3D DEC A ;ADDR = OCB_TABLE(OV_NUM-1*5) 107 0010' 4F LD C,A ;GET THE OVERLAY NUMBER IN C 108 0011' 06 00 LD B,0 109 0013' 2A 0000# LD HL,(OCB_PTR) ;POINTER TO THE OCB TABLE 110 0016' 09 ADD HL,BC ;OCB_ADDR = OVERLAY_NUM*5 + START_OF_TABLE FILE: DDP_INTER:TOS HEWLETT-PACKARD: DDP_INTERFACE (c) Coleco 1983 Confidential Mon, 21 May 1984, 16:35 Page 3 111 0017' 09 ADD HL,BC 112 0018' 09 ADD HL,BC 113 0019' 09 ADD HL,BC 114 001A' 09 ADD HL,BC 115 001B' C9 RET 116 ;* 117 001C' WRITE_OVERLAY: 118 001C' 37 SCF ;SET CARRY FLAG IF WRITE INSTRUCTION! 119 001D' 18 01 JR LD_1 120 ;* 121 ;* 122 001F' LOAD_OVERLAY: 123 001F' B7 OR A ;RESET CARRY FLAG IF READ 124 ;* 125 ;* 126 0020' LD_1: 127 ; BEGIN (Ordinarily registers are restored; retain only the pushes and pops you need.) 128 ;* 129 ;* 130 ;* 131 0020' 32 0000 LD (D_OVERLAY_NUMBER),A ;FOR DEBUGGING PURPOSES 132 ;* 133 ;* 134 0023' F5 PUSH AF ;++++++++++++++++++++; 135 0024' CD 0F00' CALL CALC_OCB_ADDR ; 136 0027' F1 POP AF ;--------------------; ;SAVE THE CARRY FLAG IF SET 137 ;* 138 0028' 30 04 JR NC,LOAD_BLOCKS 139 140 002A' WRITE_BLOCKS: 141 002A' 3E 82 LD A,WRITE_TAPE ;WRITE INSTRUCTIONS GO HERE 142 002C' 18 02 JR BLOCK_IO 143 002E' LOAD_BLOCKS: 144 002E' 3E 81 LD A,READ_TAPE ;READ INSTRUCTIONS GO HERE 145 0030' BLOCK_IO: 146 0030' 11 0100 LD DE,D_CSA+1 ; ;POINT TO THE COMMAND STATUS AREA 147 0033' 01 0500 LD BC,5 ; ;NUMBER OF BYTES TO MOVE 148 0036' ED B0 LDIR 149 0038' 11 0000 LD DE,D_CSA 150 003B' 12 LD (DE),A ;SET THE COMMAND IN THE D_CSA BUFFER 151 003C' AF XOR A 152 GLOBAL EXIT_TAPE 153 003D' EXIT_TAPE: 154 003D' C9 RET 0 Error(s) Detected. 62 Program Bytes. 17 Symbols Detected. FILE: DDP_INTER:TOS HEWLETT-PACKARD: DDP_INTERFACE (c) Coleco 1983 Confidential Mon, 21 May 1984, 16:35 Page 4 Value Symbol Defined Referenced: 0007' ABORT_TAPE 98 50 0030' BLOCK_IO 145 56 142 000F' CALC_OCB_ADDR 105 53 135 0000 D_CSA 72 92 100 146 149 0000 D_OVERLAY_NUMBER 70 131 0000 D_TAPE_STATE 71 003D' EXIT_TAPE 153 94 101 152 0087 KILL_TAPE 84 81 99 0020' LD_1 126 119 002E' LOAD_BLOCKS 143 55 138 001F' LOAD_OVERLAY 122 51 0000# OCB_PTR 67 109 0081 READ_TAPE 82 79 144 0000' TEST_TAPE 91 49 002A' WRITE_BLOCKS 140 54 001C' WRITE_OVERLAY 117 52 0082 WRITE_TAPE 83 80 141